package com.yuesystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuesystem.entity.Academy;
import com.yuesystem.mapper.AcademyMapper;
import com.yuesystem.service.AcademyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class AcademyServiceImpl extends ServiceImpl<AcademyMapper, Academy> implements AcademyService {

    @Autowired
    private AcademyMapper academyMapper;
    /**
     * 获得所有省份，去重
     * @return
     */
    @Override
    public List<Academy> getProvince() {
        QueryWrapper<Academy> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT address");
        List<Academy> academies = academyMapper.selectList(queryWrapper);
        return academies;
    }
}
